﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace JXT.PrimaryKey.Batman.Core.Configuration
{
    /// <summary>
    /// 交易所基本信息配置节点
    /// </summary>
    public class ExchangeConfigurationElement : ConfigurationElement
    {
        public ExchangeConfigurationElement()
        {
        }

        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return this["name"] as String; }
            set { this["name"] = value; }
        }

        /// <summary>
        /// 上午开盘时间
        /// </summary>
        [ConfigurationProperty("openAM", IsRequired = true)]
        public TimeSpan OpenAM
        {
            get { return (TimeSpan)this["openAM"]; }
            set { this["openAM"] = value; }
        }

        /// <summary>
        /// 上午收盘时间
        /// </summary>
        [ConfigurationProperty("closeAM", IsRequired = true)]
        public TimeSpan CloseAM
        {
            get { return (TimeSpan)this["closeAM"]; }
            set { this["closeAM"] = value; }
        }

        /// <summary>
        /// 下午开盘时间
        /// </summary>
        [ConfigurationProperty("openPM", IsRequired = true)]
        public TimeSpan OpenPM
        {
            get { return (TimeSpan)this["openPM"]; }
            set { this["openPM"] = value; }
        }

        /// <summary>
        /// 下午收盘时间
        /// </summary>
        [ConfigurationProperty("closePM", IsRequired = true)]
        public TimeSpan ClosePM
        {
            get { return (TimeSpan)this["closePM"]; }
            set { this["closePM"] = value; }
        }

        /// <summary>
        /// 延迟时间(秒)
        /// </summary>
        [ConfigurationProperty("delay", IsRequired = false, DefaultValue = 0)]
        public int Delay
        {
            get { return (int)this["delay"]; }
            set { this["delay"] = value; }
        }
    }
}
